<?
define('SITE_AREA', 'callForm');
include('includes/appInit.php');
include('includes/ajax/sysData.php');
include('includes/ajax/ajaxContactForm.php');

$jsFile = 'jsonData/jsonSchoolDistricts.js|jsContactForm'.$_SESSION['org'].'.js|jsContactFormSave'.$_SESSION['org'].'.js|jsContactFormGetData'.$_SESSION['org'].'.js|jsContactGetData.js|jsLibrary.js';

// Populate IEP Classification select menu(s)
$iepSelect  = getIEPClassifications();

// Are we coming here to edit or add?
if (empty($_GET['contactID'])) {
	/*
	 * Create new temp entry in cdc_Contacts
	 * and get $contactID
	 */
	$action    = 'add';
	$contactIDArray = createNewTempContact();
	
	$entryID   = $contactIDArray[0];
	$contactID = $contactIDArray[1];
} else {
	/*
	 * We're editing an existing entry
	 */
	$action    = 'edit';
	$entryID = $_GET['contactID'];
}

if (empty($familyID)) {
	$familyID = 0;
}

include('includes/header.php');
?>
<div id="content0" style="padding: 10px; width: 750px;" class="x-layout-inactive-content">
		<form id="contactForm">
		<div id="msg"></div>
		
		<input type="hidden" id="contactID" value="<?=$entryID; ?>" />
		<input type="hidden" id="familyID" value="<?=$familyID; ?>" />
		<input type="hidden" id="activeMemberID" />
		<input type="hidden" id="org" value="<?=$_SESSION['org']; ?>" />
		<input type="hidden" id="action" value="<?=$action; ?>" />
		
		<!-- Header Information -->
		<div class="emphBox" id="metaInfo" style="font-size: 1em; width: 100%;">
			<div class="emphBoxInner">
				<div style="float: left; width: 43%;" id="rStaffContainer">
					<b class="grayText">Entered:</b>
					<span id="staffMember" style="font-weight: bold;"><?=$_SESSION['fullName']; ?></span>
				</div>
				<div style="float: left; width: 15%; text-align: center;" id="rCallIDContainer">
					<b class="grayText">ID #:</b>
					<span id="contactIDNo" style="font-weight: bold;"><?=$contactID; ?></span>
				</div>
				<div style="float: right; width: 38%; text-align: right;">
					<div id="dateOfContact"><?=date('M j, Y g:i a'); ?></div> 
				</div>
				<div style="clear: both;"></div>				
			</div>
			<div id="contactFormStatus">
				<div id="contactFormStatusInner" style="float: left; margin-left: 4px;"></div>
				<div id="contactStatusButton" style="float: right; margin: 3px 5px 0 0;"></div>
				<div style="clear: both;"></div>
			</div>		
		</div>
						
		<h1>Subject of contact</h1>
		<input type="text" tabindex="1" style="width: 100%; margin-bottom: 10px;" onBlur="contactSaveSubject.saveSubject();" class="bigFormText" id="contactSubject" />
		
		<h1>Resource referrals</h1>
		<? require_once('includes/formModules/contactFormResources'.$_SESSION['org'].'.php'); ?>
				
		<div style="float: left;">
			<h1 style="margin-top: 15px;">Family/support team members</h1>
		</div>
		<div style="float: right; margin-top: 20px;">
			<a href="#" class="coolButton buttonBGGreen" onClick="contactFormSupportObj.addNewMemberTab(); return false;"><span class="add">Add Member</span></a>
		</div>
		<div style="clear: both;"></div>	
		<div id="familyTabs" style="margin-top: 10px; margin:15px 0;"></div>
		<!-- 
			familyTabs section is not included here - it's brought in  
			via contactFormSupportObj.addNewMemberTab(); in jsContactForm.js
		-->
		
		<div style="margin-top: 10px;">
			<h1>Client information <span class="h1SubText" id="clientName"></span></h1>
		</div>	
		<? require_once('includes/formModules/contactFormClientInformation'.$_SESSION['org'].'.php'); ?>  	
    	    	
    	<h1 style="margin-top: 15px;">Notes or Next Steps</h1>
    	<? require_once('includes/formModules/contactFormNotes.php'); ?>  
    	
    	</form>
</div>  

<div id="content1" style="padding: 10px;" class="x-layout-inactive-content">
	<input type="hidden" id="contactLogLoaded" value="0" />
	<input type="hidden" id="contactLogStart" value="<?=$_SESSION['contactLogStart']; ?>" />
	<div id="messageSearch" style="display: none;"></div>
	
	<div id="formAdvancedSearch" class="blueBox" style="display: none;">
		<p><label class="vertLabelSmall">Keyword (searches Subject)</label>
		<input type="text" style="width: 400px;" id="sKeyword" onKeyPress="if(enterPressed(event)){ searchContactsObj.advancedContactSearch(); }" /></p>
		
		<p><label class="vertLabelSmall">Family/support team member name</label></p>
		<div style="padding: 5px;"><input type="text" style="width: 400px;" id="sMemberName" onKeyPress="if(enterPressed(event)){ searchContactsObj.advancedContactSearch(); }" /></div>
		
		<p><label class="vertLabelSmall">Date Range</label></p>
		<div style="padding: 5px;"><input type="text" style="margin-bottom: 5px;" id="searchDateFieldStart" onKeyPress="if(enterPressed(event)){ searchContactsObj.advancedContactSearch(); }" />
			<input type="text"id="searchDateFieldEnd" onKeyPress="if(enterPressed(event)){ searchContactsObj.advancedContactSearch(); }" /></div>	
			
		<div style="float: left; margin-left: 5px; margin-right: 5px;">
			<a href="#" class="coolButton buttonBGBlueGray" onClick="searchContactsObj.advancedContactSearch(); return false;"><span class="search">Search</span></a>
		</div>
		<div style="float: left;">
			<a href="#" class="coolButton buttonBGRed" onClick="searchContactsObj.toggleAdvancedSearchForm(); return false;"><span class="cancel">Cancel</span></a>
		</div>
		<div style="clear: left;"></div>
	</div>
	
	<div style="float: left;">
		<div style="float: left;"><h1 id="contactLogTitle"></h1></div>
		<div style="float: left; margin-left: 20px;"><div id="contactWindowStatus"></div></div>	
		<div style="clear: left;"></div>
	</div>
	<div style="float: right; margin-right: 5px;">
		<div class="gridNavTab" id="gridNavTab" style="display: none;"></div>
	</div>	
	<div style="clear: both;"></div>
	<div style="margin-top: -6px; width: 100%;" class="dashboardWinContainer" id="windowContactsContainer"></div>
</div>
<div id="south"></div>  
<? include('includes/footer.php'); ?>